{% extends "base.html" %}
{% load static %}
{% load display_tags %}
{% block add_styles %}
    {{ block.super }}
.chosen-container {
    width: 70% !important;
}
{% endblock %}
{% block content %}
    {{ block.super }}
    <h3> Add Tests</h3>
	<p>
		<a href="https://docs.defectdojo.com/en/connecting_your_tools/import_scan_files/import_scan_ui/">Documentation</a>
	</p>
    <form class="form-horizontal" action="" enctype="multipart/form-data" method="post">
	{% csrf_token %}
	{% include "dojo/form_fields.html" with form=form %}
	{% include "dojo/form_fields.html" with form=cred_form %}
    {%  if jform %}
        <h4> JIRA </h4>
        <hr>
		<div class="form-group">
			<label class="col-sm-2 control-label" for="id_jira_issue">JIRA URL
				<i class="fa-solid fa-circle-question has-popover" data-trigger="hover" data-content="JIRA URL connected to this product or engagement" data-placement="right" data-container="body" data-original-title="" title="">
				</i>
			</label>
			<div class="col-sm-10 form-control-static">
				{% if product_tab.product.has_jira_configured %}
					<a href="{{ engagement_or_product|jira_project_url }}"
					target="_blank"> {{ engagement_or_product|jira_project_url }} </a>
				{% else %}
				None
				{% endif %}
			</div>
		</div>

        {% include "dojo/form_fields.html" with form=jform %}
    {% endif %}
	<div class="form-group">
	    <div class="col-sm-offset-2 col-sm-10">
            <button class="btn btn-primary" type="submit">Import</button>
	    </div>
	</div>
    </form>
    <div class="well">
	<p>Upload your third party tool scan results and all the findings
	    will be imported automatically.</p>

	<p>DefectDojo accepts:</p>
    <ul>
{% for k, v in scan_types %}  
    <li><b>{{ k }}</b> - {{ v }}</li>
{% endfor %}
    </ul>

	{% if additional_message %}
	    <p class="text-info">
		<b>Note:</b> {{ additional_message }}
	    </p>
	{% endif %}
    </div>
{% endblock %}
{% block postscript %}
    {{ block.super }}
	<script type="application/javascript" src="{% static "jquery.hotkeys/jquery.hotkeys.js" %}"></script>
	<script type="application/javascript" src="{% static "easymde/dist/easymde.min.js" %}"></script>
	<script type="text/javascript" src="{% static "admin/js/jquery.init.js" %}"></script>
	<script type="application/javascript" src="{% static "admin/js/admin/RelatedObjectLookups.js" %}"></script>
	<script type="application/javascript">
	$ = django.jQuery;
	$.hotkeys.options.filterInputAcceptingElements = false;
	$.hotkeys.options.filterTextInputs = false;
    </script>
{% endblock %}